<?php
namespace app\index\controller;
use think\Controller;

class Base extends Controller{
	public function _initialize(){
		$this->site();
		$this->category();
		$this->hotkey();
	}
	public function site(){
		$site = db('site')->find();
		return $site;
	}
    public function category(){
    	$category = db('category')->order('listorder asc')->select();
    	$cat = array();
    	foreach ($category as $k => $v) {
    	  	$cat[$v['catid']] =  $v['catname'];
    	}
    	$this->assign('category', $category);
    	return $cat;
    }
    public function hotkey(){
    	$hotkey = db('keyword')->limit(50)->order('videonum desc')->select();
    	foreach ($hotkey as $k => $v) {
    		$hotkey[$k]['code'] = urlencode($v['keyword']);
    	}
    	$this->assign('hotkey', $hotkey);
    }
}
